package com.mdc.mansion.api.web.modules.log;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.alibaba.fastjson.JSONObject;
import com.mdc.mansion.api.web.common.web.BaseController;
import com.mdc.mansion.common.response.Result;
import com.mdc.mansion.common.response.ResultCode;
import com.mdc.mansion.core.modules.basedata.RestaurantPrintLogService;
import com.mdc.mansion.dataaccess.common.context.ContextHolder;
import com.mdc.mansion.dataaccess.modules.basedata.entity.RestaurantPrintLog;

/**<p>com.mdc.mansion.api.web.modules.log.PrintController</p>
 * <p>Title: PrintController</p>
 * <p>Copyright: Copyright © 2010-2014</p>
 * @version 1.0
 */
@Controller
@RequestMapping(value = "${adminPath}/log/print")
public class PrintController extends BaseController {
    @Resource
    private RestaurantPrintLogService restaurantPrintLogService;
    public Result upload(String data){
        Result result = new Result(ResultCode.COMMON_SUCCESS);
        RestaurantPrintLog printLog = JSONObject.parseObject(data, RestaurantPrintLog.class);
        printLog.setRestaurantId(ContextHolder.currentRestaurantId());
        restaurantPrintLogService.save(printLog);
        return result;
    }
}
